templates: fix initramfs merge to preserve filesystem structure and symlinks (avoid cat)#36
Open
quic-mtharu wants to merge 1 commit intoqualcomm-linux:mainfrom
Open
templates: fix initramfs merge to preserve filesystem structure and symlinks (avoid cat)#36quic-mtharu wants to merge 1 commit intoqualcomm-linux:mainfrom
quic-mtharu wants to merge 1 commit intoqualcomm-linux:mainfrom
Conversation
anankulk
approved these changes
Feb 27, 2026
yogeshlal
reviewed
Mar 5, 2026
The current initramfs merge logic concatenates cpio payloads using `cat`. Stream concatenation does not merge filesystem structure and can break early boot path/symlink resolution when firmware and symlinks are split across multiple archives. Replace the `cat` approach with an extract-into-one-dir + repack workflow when firmware_name is provided: - extract ramdisk into a staging rootfs - extract firmware archive into the same staging tree - repack as a single newc cpio.gz (preserving symlinks and hierarchy) If firmware_name is not provided, the template produces the merged output by renaming the original ramdisk artifact to merged-initramfs.cpio.gz. This improves reliability of /lib -> /usr/lib and /lib/firmware resolution during early boot and avoids firmware load failures. Signed-off-by: Tharun Kumar Merugu <mtharu@qti.qualcomm.com>
anankulk
approved these changes
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR updates the initramfs merging logic in the fastboot template to avoid using
catfor combining initramfs/firmware archives. Instead, when a firmware archive is present, we extract both archives into a single staging directory and repack them into a unifiedmerged-initramfs.cpio.gz.Problem
The previous approach concatenated cpio files using
cat:cat initramfs-kerneltest-full-image-qcom-armv8a.cpio \ initramfs-firmware-rb3gen2-image-qcom-armv8a.cpio \ > merged-initramfs.cpio gzip merged-initramfs.cpioThis is a byte-stream concatenation and does not actually merge filesystem trees. When one archive provides symlinks (e.g.,
/lib -> /usr/lib) and the other provides firmware files, early boot path resolution can break (e.g.,/lib/firmwarenot resolving correctly), causing firmware load failures.Solution
When
firmware_nameis provided, we now perform a correct merge:rootfs)newcinitramfs archive (merged-initramfs.cpio.gz)This preserves:
Scope / Impact
merged-initramfs.cpio.gz).